package com.example.mobile2021606177cke0427;

import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private TextView editText;
    private Button btnMainSea;
    private RecyclerView rvMainParking;
    private List<Parking> list = new ArrayList();
    private int[] parkIds={R.drawable.p1,R.drawable.p2,R.drawable.p3,R.drawable.p4};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        rvMainParking.setLayoutManager(new LinearLayoutManager(this));
        rvMainParking.setAdapter(new ParkingRVAdapter(list));
        list.add(new Parking(R.drawable.p1,"广州停车场","空位：39","价格：30/小时","距离：10公里","地址：广州天河区","更多信息"));
        list.add(new Parking(R.drawable.p2,"佛山停车场","空位：59","价格：10/小时","距离：20公里","地址：佛山高明富湾","更多信息"));
        list.add(new Parking(R.drawable.p3,"江门停车场","空位：40","价格：20/小时","距离：25公里","地址：江门新会","更多信息"));
        list.add(new Parking(R.drawable.p4,"深圳停车场","空位：60","价格：50/小时","距离：30公里","地址：深圳龙湖","更多信息"));
    }

    private void initView() {
        editText = (TextView) findViewById(R.id.edit_text);
        btnMainSea = (Button) findViewById(R.id.btn_main_sea);
        rvMainParking = (RecyclerView) findViewById(R.id.rv_main_parking);

    }
}